package com.huang.design.behavior.Responsibility;


public  class Teacher {

    @Override
    public String toString() {
        return "Teacher{" +
                "next=" + next +
                ", name='" + name + '\'' +
                '}';
    }

    // 引
    private Teacher next;
    private String name;

    public Teacher(String name) {
        this.name = name;
    }

    public Teacher getNext() {
        return next;
    }

    public void setNext(Teacher next) {
        this.next = next;
    }
        //处理完  交给下一个
     void handleRequest(){
         System.out.println(this+"正在处理");
        if(next!=null) {
            next.handleRequest();
        }
     };
}
